<style scoped>
  .weui-media-box_appmsg .weui-media-box__hd {
    font-size: 12px;
    width: 50px;
    height: 50px;
    line-height: 50px;
    border-radius: 50%;
    background: blue;
    color: #fff;
  }
  .weui-media-box__desc {
    font-size: 12px;
  }
  .weui-media-box__title {
    white-space: normal;
    font-size: 14px;
    margin-bottom: 5px;
  }
  .weui-form-preview__bd {
    text-align: left;
  }

  .weui-form-preview {
    position: relative;
    background-color: #fff;
    margin: 1%;
    border-radius: 5px;
  }
  .time {
    position: absolute;
    right: 0;
    top: 0;
    font-size: 10px;
    color: #ccc;
  }

  .attachimg {
    width: 14px;
    height: 14px;
  }
  .imgicon {
    position: absolute;
    right: 0;
    bottom: 0;
  }
</style>
<template>
  <div class="logs">
    <div style="overflow:auto;overflow-x: hidden;" v-show="logs.length > 0">
      <div class="weui-cells__title">审批记录</div>
      <div class="weui-form-preview" v-for="(item, index) in logs">
        <div class="weui-form-preview__bd">
          <a href="javascript:void(0);" class="weui-media-box weui-media-box_appmsg">
            <div class="weui-media-box__hd" style="overflow: hidden;">
              {{item.operator}}
            </div>
            <div class="weui-media-box__bd" style="position: relative;">
              <p class="time">{{item.createtime}}</p>
              <h4 class="weui-media-box__title">{{item.operationname}}</h4>
              <p class="weui-media-box__desc">{{item.description}}</p>

              <div class="exp uploaderFiles" style="display: inline-block;" v-if="item.imgs.length > 0">
                <img class="attachimg" style="padding-right: 5px;"  v-for="(image, index) in item.imgs" :key="image.guid"  alt="" onerror="javascript:this.src='../../../static/image/default.png';this.onerror = null" :src="image.url + '-suolue.png'" :data-img="image.url + '.png'" />
              </div>
            </div>
          </a>
          <!--          <div class="weui-media-box weui-media-box_text uploaderFiles" style="padding-bottom: 0;">-->
          <!--          </div>-->
        </div>
      </div>
    </div>
  </div>
</template>

<script>
  export default {
    name: 'OperationLogs',
    data () {
      return {
        logs: [],
      }
    },
    props: [
      'orderid'
    ],
    watch: {
      'orderid': function (val) {
        this.getOperatelogs(val);
      }
    },
    methods: {
      getOperatelogs: function (id) {
        this.axios({
          method: 'get',
          url: '/sales/Operationlogs!getOperateLogs.action',
          params: {orderid: id}
        }).then(response => {
          if (response.data.msg == 'success') {
            let data = response.data;
            this.logs = data.logs;
            console.log('logs:', this.logs)
          } else {
            //this.toastError('获取审批记录失败');
          }
        });
      },

    }
  }
</script>
